<template>
    <el-card>
        <el-form inline>
            <el-form-item label="一级菜单">
                <el-select v-model="getCategorys.cfId" @change="getSecondSel()" :disabled="fatData.isAble?false:true">
                    <el-option v-for="(item, index) in getCategorys.cateGory1" :value="item.id" :key="item.id"
                        :label="item.name"></el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="二级菜单">
                <el-select v-model="getCategorys.csId" @change="getThirdSel()" :disabled="fatData.isAble?false:true">
                    <el-option v-for="(item, index) in getCategorys.cateGory2" :value="item.id" :key="item.id"
                        :label="item.name"></el-option>
                </el-select>
            </el-form-item>

            <el-form-item label="三级菜单">
                <el-select v-model="getCategorys.ctId" :disabled="fatData.isAble ? false : true">
                    <el-option v-for="(item, index) in getCategorys.cateGory3" :value="item.id" :key="item.id"
                        :label="item.name"></el-option>
                </el-select>
            </el-form-item>
        </el-form>
    </el-card>
</template>

<script setup lang="ts">
import { getCategory } from "../../../store/modules/Category"

import { onMounted } from "vue"

let getCategorys = getCategory();

let fatData = defineProps(["isAble"])




// 一级菜单请求函数
const hasgetCategory1 = () => {


    getCategorys.getCategory1()
}

// 二  级菜单请求
const getSecondSel = () => {
        getCategorys.csId = '';
        getCategorys.cateGory2 = [];
        getCategorys.ctId = '';
        getCategorys.cateGory3 = [];
        getCategorys.getCategory2()
}
// 三级
const getThirdSel = () => { 
          
    getCategorys.ctId = '';
    getCategorys.cateGory3 = [];



getCategorys.getCategory3()
}

onMounted(() => {
    hasgetCategory1()

})


</script>

<script lang="ts">
export default {
    name: "topCard"
}
</script>

<style scoped></style>